clearvars -except Globaloption option

if exist('Globaloption', 'var') == 0
    Globaloption.savefig = 1;
end

warning off

%%%UK

warning off

data = readtable('../../data/main_VAR/UK_full.xlsx');

startdatenum = 1700;
enddatenum = 1938;

data = data((data.Year >= startdatenum), :);
data = data((data.Year <= enddatenum), :);

longrate_UK = data.rate_10year / 100;

clear data

%%%1
data = readtable('../../data/Netherlands/Holland_PF_v2.xlsx');

startdatenum = 1600;
enddatenum = 1794;

data = data((data.Var1 >= startdatenum), :);
data = data((data.Var1 <= enddatenum), :);

longrate_H1 = data.y10;

%%%2
data = readtable('../../data/Netherlands/NetherlandsPF_1815_1938.xlsx');
date = data.year;

startdatenum = 1817;
enddatenum = 1938;

data = data((data.year >= startdatenum), :);
data = data((data.year <= enddatenum), :);
%
longrate_H2 = data.y10;

%%%% organize
longrate_H = [longrate_H1; nan(1817 - 1794 - 1, 1); longrate_H2; ];

startdatenum = 1600;

date = startdatenum:enddatenum';

diff = mean(longrate_UK(1:95) - longrate_H1(101:end));

%%
f = figure('units', 'normalized', 'outerposition', [0 0 .3 .3]);
box on
l1 = plot(date, longrate_H, 'blue', 'LineWidth', 2)
hold on
l2 = plot([1700:1:1938], longrate_UK, '--red', 'LineWidth', 2)
ylim([0, 0.09])
xlim([1598 1940])
grid on
hleglines = [l1 l2];
hleg = legend(hleglines, 'Netherlands Long Yield (With tax adjustment)', 'UK Long Yield', 'location', 'SouthWest', 'fontsize', 9);
set(gcf, 'PaperUnits', 'inches', 'Units', 'inches');
f.PaperSize = [6 4];
set(gca, 'Layer', 'top', 'FontSize', 10)
set(gca, 'FontName', 'Times New Roman')

if Globaloption.savefig == 1
    print('../../results/figures_main/Netherlands/y10compare', '-dpdf', '-fillpage')
end
